package com.example.hao.qqwechat.fragment;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;


import com.example.hao.qqwechat.R;

import java.util.Objects;


/**
 * A simple {@link Fragment} subclass.
 */
public class MsgFragment extends Fragment {


    private View inflate;
    private ListView lv;

    public MsgFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        inflate = inflater.inflate(R.layout.fragment_msg, container, false);
        initView();
        return inflate;
    }

    private void initView() {
        lv = inflate.findViewById(R.id.lv);
        String[] strs = new String[20];
        for (int i = 0; i < strs.length; i++) {
            strs[i] = "item" + i;

        }
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(Objects.requireNonNull(getActivity()), android.R.layout.simple_expandable_list_item_1, strs);
        lv.setAdapter(adapter);
    }

}
